package jrdcom.com.onecodesample.DB;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by longcheng on 17/1/17.
 */
public class CoolWeatherOpenHelper extends SQLiteOpenHelper {
    private static final String CREATE_PROVINCE = "create table Province(" +
            "province_id integer primary key autoincrement," +
            "province_name text," +
            "province_code text)";
    private static final String CREATE_CITY = "create table City(" +
            "city_id integer primary key autoincrement," +
            "city_name text," +
            "city_code text," +
            "province_id text)";
    private  static final String CREATE_COUNTRY ="create table Country(" +
            "country_id integer primary key autoincrement," +
            "country_name text," +
            "country_code text," +
            "city_id text)";
    public CoolWeatherOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version){
        super(context, name, factory,version);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_PROVINCE);
        db.execSQL(CREATE_CITY);
        db.execSQL(CREATE_COUNTRY);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
